home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20031118-20041115 / 000033_fdc@columbia.edu_Tue Dec 2 09:55:38 2003.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Path: newsmaster.cc.columbia.edu!not-for-mail
  2. From: Frank da Cruz <fdc@columbia.edu>
  3. Newsgroups: comp.protocols.kermit.misc
  4. Subject: Re: wierd scripting query via telnet
  5. Date: 2 Dec 2003 14:47:51 GMT
  6. Organization: Columbia University
  7. Lines: 61
  8. Message-ID: <slrnbsp9gn.bcn.fdc@sesame.cc.columbia.edu>
  9. References: <e516d9ec.0312020211.2fa9cb80@posting.google.com>
  10. Reply-To: fdc@columbia.edu
  11. NNTP-Posting-Host: sesame.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1070376471 12159 128.59.59.56 (2 Dec 2003 14:47:51 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 2 Dec 2003 14:47:51 GMT
  15. User-Agent: slrn/0.9.7.4 (SunOS)
  16. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14709
  17.  
  18. In article <e516d9ec.0312020211.2fa9cb80@posting.google.com>,
  19. Mark Swarbrick wrote:
  20. : I'm trying to write a little utility which does the following:
  21. : connect via telnet to port 1494 (citrix ica) wait about 5 seconds
  22. : after connecting and dump to a bash variable the contents of what was
  23. : echoed to screen for checking if the citrix machine is working
  24. : properly.
  25. Conceptually it's easy (except for the "bash variable" part; see below).
  26. In practice it depends on whether Citrix ICA is normal enough to allow a
  27. regular non-protocol raw-socket connection to be made to it.  I have no
  28. idea.
  29.  
  30. : The citrix ica client just echo's ICAICA until it closes the port.
  31. : this takes too long so i just want to script kermit-telnet to keep the
  32. : connection open for around 5 seconds and keep the data so I can check
  33. : the contents.
  34. : How would I go about this?
  35. : So far all i've got is:
  36. : #!/usr/local/bin/kermit
  37. : telnet /nowait 102.12.76.37 1494
  38. : But this takes ages to run and doesn't dump back the contents... 
  39. If it takes ages to run, then maybe there's something about Citrix that
  40. Kermit needs to know, but does not.  Is it using some Microsoft-specific
  41. protocol, such as VTNT?  If so, C-Kermit does not support it (but K95
  42. might).
  43.  
  44. Leaving Citrix out of the picture, let's say you were making a connection
  45. to some normal, text-based TCP service and you wanted to capture 5 seconds
  46. worth of whatever it spewed out:
  47.  
  48.   clear input
  49.   set host 102.12.76.37 1494 /raw
  50.   input 5 STRING_THAT_WILL_NEVER_COME
  51.   if success exit 1 "Uh oh - STRING_THAT_WILL_NEVER_COME did come!"
  52.   close
  53.  
  54. At this point all the characters that arrived (except NULs) are in the
  55. Kermit variable \v(input).  You can do whatever you want with this variable
  56. except assign its value to a bash variable that will be visible when the
  57. script (and Kermit) exit, because of a fundamental rule of Unix: a process
  58. may not manipulate the environment of a superior process.
  59.  
  60. To pass the value back to bash, you could write it out to a file.  That's
  61. easy enough:
  62.  
  63.   log session
  64.   set host 102.12.76.37 1494 /raw
  65.   input 5 STRING_THAT_WILL_NEVER_COME
  66.   if success exit 1 "Uh oh - STRING_THAT_WILL_NEVER_COME did come!"
  67.   exit 0
  68.  
  69. All the bytes that arrived will be in the session.log file.
  70.  
  71. - Frank
  72.